package com.bowen.chapter11.refactor;

import java.util.HashMap;
import java.util.Map;

public class UserPrefs {

    private Map<String, String> preference = new HashMap<>();

    public void loadPreference() {
        // 想做解析数据
        this.preference.put("配置KEY_1", "配置值_1");
        this.preference.put("配置KEY_2", "配置值_2");
    }

    public void setBoolForKey(String key, String v) {
        this.preference.put(key, v);
    }

    public Object getBoolForKey(String key, String def) {
        return this.preference.containsKey(key) ? this.preference.get(key) : def;
    }

}
